<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../Template/generalTemplate.xhtml">

            <ui:define name="content">
                <f:view beforePhase="#{editDailyMPSTableManagedBean.initView}">
                    <h:form id="form">
                   <p:growl id ="growl" showDetail="true"/>
                        <p:panel id="editMPSTableA" header="Daily MPS Table" style="height:495px;">
                            <p:wizard showNavBar="false" showStepStatus="false"  widgetVar="wiz" style="height:450px;" flowListener="#{editDailyMPSTableManagedBean.onFlowProcess}">
                                <p:tab title="1" id="a">
                                    <h3>
                                        <h:outputText value="Daily MPS for Product A" />
                                        <h:outputText style="margin-left:15px; font-size:12px;" value= "Production BalanceA: "/>
                                        <h:outputText style="margin-left:15px; color:blue;" id ="balanceA" value="#{editDailyMPSTableManagedBean.amountBalanceA}"/>
                                        <p:commandButton value="Update"  update="growl" ajax="false" actionListener="#{editDailyMPSTableManagedBean.updateA}" style="margin-left:50px;"/>

                                        <p:poll interval="2"   
                                                actionListener="#{editDailyMPSTableManagedBean.calculateAmountA}" update="balanceA"  />
                                    </h3>
                                    <p:dataTable id="mpsTableViewA" dynamic="true" emptyMessage="No Item to display" value="#{editDailyMPSTableManagedBean.dailyMpsListA}" var ="dailyMpsListA" paginator="true" rows="10">
                                        <p:column>
                                            <f:facet name="header">Day</f:facet>
                                            <h:outputText value="#{dailyMpsListA.monthName} "/>
                                            <h:outputText value="#{dailyMpsListA.currentDay}"/>    
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Demand</f:facet>
                                            #{dailyMpsListA.productionDemand}                                           
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            <p:inplace editor="true" onEditUpdate="mpsTableViewA">
                                                <p:inputText value="#{dailyMpsListA.dailyDetailEntity.scheduleA}" />
                                            </p:inplace>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory Level</f:facet>
                                               #{dailyMpsListA.inventory}                         
                                        </p:column>


                                    </p:dataTable>
                                    <p:commandButton style="margin-top:20px; margin-right:5px; position:relative;float:right" value="Next" onclick="wiz.next()" ></p:commandButton>
                                </p:tab>
                                <p:tab title="2" id="b">
                                    <h3>
                                        <h:outputText value="Daily MPS for Product B" />
                                        <h:outputText style="margin-left:15px; font-size:12px;" value= "Production BalanceB: "/>
                                        <h:outputText style="margin-left:15px;color:blue;" id ="balanceB" value="#{editDailyMPSTableManagedBean.amountBalanceB}"/>
                                        <p:commandButton value="Update"  update="growl" ajax="false" actionListener="#{editDailyMPSTableManagedBean.updateB}" style="margin-left:50px;"/>

                                        <p:poll interval="2"   
                                                actionListener="#{editDailyMPSTableManagedBean.calculateAmountB}" update="balanceB"  />
                                    </h3>

                                    <p:dataTable id="mpsTableViewB" dynamic="true" emptyMessage="No Item to display" value="#{editDailyMPSTableManagedBean.dailyMpsListB}" var ="dailyMpsListB" paginator="true" rows="10">
                                        <p:column>
                                            <f:facet name="header">Day</f:facet>
                                            <h:outputText value="#{dailyMpsListB.monthName} "/>
                                            <h:outputText value="#{dailyMpsListB.currentDay}"/>    
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Demand</f:facet>
                                            #{dailyMpsListB.productionDemand}                                           
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            <p:inplace editor="true" onEditUpdate="mpsTableViewB">
                                                <p:inputText value="#{dailyMpsListB.dailyDetailEntity.scheduleB}" />
                                            </p:inplace>
                                        </p:column>
                                         <p:column>
                                            <f:facet name="header">Inventory Level</f:facet>
                                               #{dailyMpsListB.inventory}                         
                                        </p:column>
                                    </p:dataTable>
                                    <p:commandButton style="margin-top:20px; margin-left:5px; position:relative;float:left" value="Back" onclick="wiz.back()" ></p:commandButton>
                                    <p:commandButton style="margin-top:20px; margin-right:5px; position:relative;float:right" value="Next" onclick="wiz.next()" ></p:commandButton>
                                </p:tab>
                                <p:tab title="3" id="c">
                                    <h3>
                                        <h:outputText value="Daily MPS for Product C" />
                                        <h:outputText style="margin-left:15px; font-size:12px;" value= "Production BalanceC: "/>
                                        <h:outputText style="margin-left:15px;color:blue;" id ="balanceC" value="#{editDailyMPSTableManagedBean.amountBalanceC}"/>
                                        <p:commandButton value="Update"  update="growl" ajax="false" actionListener="#{editDailyMPSTableManagedBean.updateC}" style="margin-left:50px;"/>
                                        <p:poll interval="2"   
                                                actionListener="#{editDailyMPSTableManagedBean.calculateAmountC}" update="balanceC"  /></h3>

                                    <p:dataTable id="mpsTableViewC" dynamic="true" emptyMessage="No Item to display" value="#{editDailyMPSTableManagedBean.dailyMpsListC}" var ="dailyMpsListC" paginator="true" rows="10">
                                        <p:column>
                                            <f:facet name="header">Day</f:facet>
                                            <h:outputText value="#{dailyMpsListC.monthName} "/>
                                            <h:outputText value="#{dailyMpsListC.currentDay}"/>    
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Demand</f:facet>
                                            #{dailyMpsListC.productionDemand}                                           
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            <p:inplace editor="true" onEditUpdate="mpsTableViewC">
                                                <p:inputText value="#{dailyMpsListC.dailyDetailEntity.scheduleC}" />
                                            </p:inplace>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory Level</f:facet>
                                               #{dailyMpsListC.inventory}                         
                                        </p:column>
                                    </p:dataTable>
                                    <p:commandButton style="margin-top:20px; margin-left:5px; position:relative;float:left" value="Back" onclick="wiz.back()" ></p:commandButton>
                                    <p:commandButton style="margin-top:20px; margin-right:5px; position:relative;float:right" value="Next" onclick="wiz.next()" ></p:commandButton>

                                </p:tab>
                                <p:tab title="4" id="d">
                                    <h3>
                                        <h:outputText value="Daily MPS for Product D" />

                                        <h:outputText style="margin-left:15px; font-size:12px;" value= "Production Balance: "/>
                                        <h:outputText style="margin-left:15px;color:blue;" id ="balanceD" value="#{editDailyMPSTableManagedBean.amountBalanceD}"/>
                                        <p:commandButton value="Update"  update="growl" ajax="false" actionListener="#{editDailyMPSTableManagedBean.updateD}" style="margin-left:50px;"/>
                                        <p:poll interval="2"   
                                                actionListener="#{editDailyMPSTableManagedBean.calculateAmountC}" update="balanceD"  />
                                    </h3>
                                    <p:dataTable id="mpsTableViewD" dynamic="true" emptyMessage="No Item to display" value="#{editDailyMPSTableManagedBean.dailyMpsListD}" var ="dailyMpsListD" paginator="true" rows="10">
                                        <p:column>
                                            <f:facet name="header">Day</f:facet>
                                            <h:outputText value="#{dailyMpsListD.monthName} "/>
                                            <h:outputText value="#{dailyMpsListD.currentDay}"/>    
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Demand</f:facet>
                                            #{dailyMpsListD.productionDemand}                                           
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            <p:inplace editor="true" onEditUpdate="mpsTableViewD">
                                                <p:inputText value="#{dailyMpsListD.dailyDetailEntity.scheduleD}" />
                                            </p:inplace>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory Level</f:facet>
                                               #{dailyMpsListD.inventory}                         
                                        </p:column>
                                    </p:dataTable>
                                    <p:commandButton style="margin-top:20px; margin-left:5px; position:relative;float:left" value="Back" onclick="wiz.back()" ></p:commandButton>


                                </p:tab>

                            </p:wizard>    
                        </p:panel>

                    </h:form>
                </f:view>
            </ui:define>

        </ui:composition>

    </body>
</html>
